<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('Course/index')}">所有课程</a></li>
        <li><a href="{:url('Course/add')}">添加课程</a></li>
    </ul>
    <form class="well form-inline margin-top-20 row" method="post" action="{:url('Course/index')}">
        <label for="状态搜索" class="col-xs-3 form-group">
            状态:
            <select class="form-control" name="enabled">
                <option value='2' {$c|default="0"}>全部</option>
                <option value='1' {$a|default="0"}>前台可见</option>
                <option value='0' {$b|default="0"}>前台不可见</option>
            </select>
        </label>
        <label for="列表搜索" class="col-xs-3 form-group">
            类别:
            <select class="form-control" name="category" >
                <option value='0'>课程类别</option>
                {$category_tree|default=''}
            </select>
        </label>
        <label for="关键词搜索" class="col-xs-4 form-group">
            课程关键字:
            <input type="text" class="form-control" name="keyword"
                   value="{$keyword|default=''}" placeholder="请输入关键字">
        </label>
        <label for="搜索" class="col-xs-2 form-group">
            <input type="submit" class="btn btn-primary" value="搜索"/>
            <a class="btn btn-danger" href="{:url('Course/index')}">清空</a>
        </label>
    </form>
    <form class="js-ajax-form" action="" method="post">
        <div class="table-actions">
            <button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
                    data-action="{:url('Course/delete')}" data-subcheck="true" data-msg="您确定删除吗？">
               批量删除
            </button>
            <button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
                    data-action="{:url('Course/visible')}" data-subcheck="true" data-msg="您确定吗？">全部可见/不可见
            </button>
        </div>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <!--<th width="15">-->
                    <!--<label>-->
                        <!--<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">-->
                    <!--</label>-->
                <!--</th>-->
                <!--
                <notempty name="category">
                    <th width="50">{:lang('SORT')}</th>
                </notempty>
                -->
                <th width="15">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <!--<th width="80">排序</th>-->
                <th width="50">编号</th>
                <th width="100">课程类别</th>
                <th width="120">课程</th>
                <th width="100">课程价格(元)</th>
                <th width="120">课时数</th>
                <th width="70">状态</th>
                <th width="150">操作</th>
            </tr>
            </thead>
            <foreach name="courses" item="vo">
                <tr>
                    <td>
                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo.id}" title="ID:{$vo.id}">
                    </td>
                    <!--<td>-->
                        <!--<input type="text" value="{$vo.list_order}" style="width:50px"  class="ids_sort"  attr_id="{$vo.id}">-->
                    <!--</td>-->
                    <td>{$vo.id}</td>
                    <td>{$vo.name}</td>
                    <td>
                            {$vo.course_name}
                    </td>
                    <td>{$vo.total_price}</td>
                    <td>{$vo.course_hour}</td>
                    <td>
                       <if condition="$vo.enabled eq 1" >
                           <span class="label label-success">可见</span>
                           <else />
                           <span class="label label-danger">不可见</span>
                       </if>
                    </td>
                    <td>
                        <a href="{:url('Course/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a> |
                        <a href="{:url('Course/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
                    </td>
                </tr>
            </foreach>
        </table>
        <div class="pagination">{$page|default=''}</div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/layer/layer.js"></script>
<script>

    $(function () {

        //排序
        $(".ids_sort").change(function(){
            var _this=$(this);
            $.ajax({
                'url':'lister_order',
                'data':{'id':_this.attr('attr_id'),'list_order':_this.val()},
                'success':function(data)
                {
                    layer.msg('操作成功');
                },
                'error':function()
                {
                    layer.msg('操作失败');
                }
            })
        })
    });
</script>
</body>
</html>